/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.zhaojiu.service;

import me.zhengjie.modules.zhaojiu.domain.Department;
import me.zhengjie.modules.zhaojiu.service.dto.DepartmentDto;
import me.zhengjie.modules.zhaojiu.service.dto.DepartmentQueryCriteria;
import java.util.List;
import java.io.IOException;
import java.util.Set;
import javax.servlet.http.HttpServletResponse;

/**
* @website https://el-admin.vip
* @description 服务接口
* @author Jiayin Wei
* @date 2021-12-09
**/
public interface DepartmentService {

    /**
     * 查询所有数据
     * @param criteria 条件
     * @param isQuery /
     * @throws Exception /
     * @return /
     */
    public List<DepartmentDto> queryAll(DepartmentQueryCriteria criteria, Boolean isQuery) throws Exception;

    /**
     * 根据ID查询
     * @param deptId ID
     * @return DepartmentDto
     */
    DepartmentDto findById(Long deptId);

    /**
     * 根据PID查询
     * @param pid /
     * @return /
     */
    public List<Department> findByPid(long pid);
    /**
    * 创建
    * @param resources /
    */
    void create(Department resources);

    /**
    * 编辑
    * @param resources /
    */
    void update(Department resources);

    /**
     * 删除
     * @param departmentDtos /
     *
     */
    void delete(Set<DepartmentDto> departmentDtos);

    /**
    * 导出数据
    * @param all 待导出的数据
    * @param response /
    * @throws IOException /
    */
    void download(List<DepartmentDto> all, HttpServletResponse response) throws IOException;

    /**
     * 获取待删除的学院、专业
     * @param menuList
     * @param departmentDtos
     * @return
     */
    public Set<DepartmentDto> getDeleteDepartments(List<Department> menuList, Set<DepartmentDto> departmentDtos);
    /**
     * 根据ID获取同级与上级数据
     * @param departmentDto /
     * @param departments /
     * @return /
     */
    List<DepartmentDto> getSuperior(DepartmentDto departmentDto, List<Department> departments);

    /**
     * 构建树形数据
     * @param departmentDtos /
     * @return /
     */
    Object buildTree(List<DepartmentDto> departmentDtos);

    /**
     * 获取
     * @param departmentList
     * @return
     */
    List<Long> getDepartmentChildren(List<Department> departmentList);
}
